package com.hurl.waguji.web.admin;

import com.hurl.library.util.StringUtils;
import com.hurl.waguji.base.Configuration;
import com.hurl.waguji.base.Struts2Utils;
import com.opensymphony.xwork2.ActionSupport;

public class LoginAction extends ActionSupport{
	private String username;
	private String userpassword;
	private String result;
	
	public String getResult() {
		return result;
	}


	public void setResult(String result) {
		this.result = result;
	}


	public String getUsername() {
		return username;
	}


	public void setUsername(String username) {
		this.username = username;
	}


	public String getUserpassword() {
		return userpassword;
	}


	public void setUserpassword(String userpassword) {
		this.userpassword = userpassword;
	}


	@Override
	public String execute() throws Exception {
		if(StringUtils.isNotBlank(username) && StringUtils.equals(userpassword, Configuration.getAdminPassword())){
			result = "1";
			Struts2Utils.getSessionAttributes().put("username", username);
		}else{
			result = "登录密码不正确！";
		}
		return SUCCESS;
	}
	
}
